fix: move X-Glean header config to preserved hooks package#67
Merged
chris-freeman-glean merged 2 commits intomainfrom Feb 3, 2026
Merged
Conversation
The custom fields added to SDKConfiguration in #66 are removed when Speakeasy regenerates the SDK, breaking the build. This moves the configuration to a dedicated GleanCustomConfig singleton in the preserved hooks/ package. Changes: - Add GleanCustomConfig singleton for custom configuration storage - Add GleanBuilder wrapper with excludeDeprecatedAfter/includeExperimental methods - Update XGleanHeadersHook to read from GleanCustomConfig instead of SDKConfiguration - Update tests to use GleanCustomConfig - Update README to document GleanBuilder usage
src/main/java/com/glean/api_client/glean_api_client/hooks/XGleanHeadersHook.java
Outdated
Show resolved
Hide resolved
src/main/java/com/glean/api_client/glean_api_client/hooks/GleanCustomConfig.java
Outdated
Show resolved
Hide resolved
Avoid global singleton state by mapping custom config to SDKConfiguration via a WeakHashMap registry, and restore compatibility by reading SDKConfiguration values via reflection when present.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes the daily CI Generate workflow failures that started after #66 was merged.
Problem
PR #66 added custom fields (
excludeDeprecatedAfter,includeExperimental) toSDKConfiguration.javaandGlean.java. However, these files are auto-generated by Speakeasy and marked "DO NOT EDIT". When the SDK regenerates, these custom fields are removed, butXGleanHeadersHook.java(in the preservedhooks/package) still references them:Solution
Move the custom configuration to a dedicated class in the preserved
hooks/package:GleanCustomConfig.java- Thread-safe singleton storing custom config valuesGleanBuilder.java- Builder wrapper that delegates toGlean.Builderbut addsexcludeDeprecatedAfter()andincludeExperimental()methods that write to the singletonXGleanHeadersHook.java- Updated to read fromGleanCustomConfiginstead ofSDKConfigurationUsers now use
GleanBuilder.create()instead ofGlean.builder()when they need the custom options:Environment variables continue to work unchanged.
Test plan
./gradlew buildpasses./gradlew test --tests "XGleanHeadersHookTest"passesspeakeasy runregeneration